// ================================================== //
// ============= BEBOPTOOLS : BOPBOARD ============== //
// ================================================== //

// Samuel Kvaalen
// functions "utils"

// ================================================== //

void toggle_fullscreen(){
	if(fullscreen_mode) screen = SDL_SetVideoMode(WINWIDTH, WINHEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
	else screen = SDL_SetVideoMode(WINWIDTH, WINHEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN);
	fullscreen_mode = !fullscreen_mode;
}

void relacher(){
	int i;
	for(i=0;i<NUMPUSH;i++)
		push[i]->pressed = 0;
}

// dessiner l'interface
void draw_interface(){
	int i;
	// dessiner le fond
	SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 28, 28, 69));
	
	// dessiner les plaques
	for(i=0;i<NUMPLATES;i++)
		SDL_BlitSurface(plates[i].img,
						NULL, screen, &(plates[i].pos));
	
	//dessiner les boutons
	for(i=0;i<NUMBUTTONS;i++)
		SDL_BlitSurface(!(*buttons[i])->pressed
						? ((*((*buttons[i])->img))->imgup)
						: ((*((*buttons[i])->img))->imgdown),
						NULL, screen, &((*buttons[i])->pos));

	// dessiner les boutons particuliers
	for(i=0;i<NUMFUNCBUTTON;i++)
		SDL_BlitSurface(funcbutton[i].img,
						NULL, screen, &(funcbutton[i].pos));

	// afficher le tout
	SDL_Flip(screen);
}
